package com.example.springboot.mapper;


import com.example.springboot.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
@Mapper
public interface TeacherMapper {
    @Select("SELECT * FROM teacher limit #{pageNum},#{pageSize}")
    List<Teacher> findAll(Integer pageSize,Integer pageNum);
    @Select("SELECT name FROM teacher where job_id = #{job_id}")
    String findTeacheName(Integer job_id);


    @Select("select count(*) from teacher ")
    Integer findCount();

    @Select("select * from teacher  where  job_id = #{teacher_id}")
    Teacher fondPeson(Integer teacher_id);

    @Update("update teacher set name = #{name},sex=#{sex},password = #{password},phone=#{phone} ,email=#{email} where job_id =#{job_id} ")
    int update_teacher(Teacher teacher);

    @Select("select job_id from teacher where name = #{name}")
    Integer getTeacher_id(String teacherName);
    @Select("select * from teacher where job_id = #{str}")
    List<Teacher> teacher_idSelect(String str);

    @Select("select * from teacher where name like #{str}")
    List<Teacher> teacher_nameSelect(String s);
    @Select("select teacher.* ,department.department_name from teacher,department where department.department_id = teacher.department_id and department.department_name =#{department_name}")
    List<Teacher> getTeacherDepa(String department_name);
}
